home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
pascal
/
tpb4_src.zip
/
INITIAL3.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-09-13
|
12KB
|
368 lines
{ TPBoard 4.2 Copyright (c) 1987,88 by Jon Schneider & Rick Petersen
Portions Copyright (c) 1986,87 by Steve Fox and Les Archambault
Last modified :: 6-15-88 11:39 pm
}
{$R-} {Range checking off}
{$B-} {Boolean complete evaluation off}
{$S-} {Stack checking off}
{$I+} {I/O checking on}
{$N-} {No numeric coprocessor}
Unit Initial3;
Interface
Uses
TPCrt, Dos, Globals, TPSTRING,
TPDOS, Core1, Core2;
procedure ReadConfigFile;
procedure ReadOrigFile;
procedure ReadSectionFile;
{==========================================================================}
Implementation
procedure ReadConfigFile;
var
ets, co, am,
ll, r300, rp,
dok, ma,
dd, fo : Char;
i : Integer;
CreditVal : Byte;
begin ;
Assign(config_file, 'CONFIG.BB#');
{$I-}
Reset(config_file); {$I+}
if IoResult = 0 then
begin
Read(config_file, maxfree_uplds, maxfree_logs, maxfree_mslimit,
maxfree_lines, maxfree_abs, ExtraTimeStart, ExtraTimeStop,
extra_time_val, chatstart, chatend, sleepy_time, max_tries,
auto_macro_start, max_msg_lines, start_restrict300, end_restrict300,
up_down_ratio, val_time, uval_time, val_acc, uval_acc, val_days,
unv_days, unr_days, rea_days, new_days, this_node, this_net,
answer_delay, Attention, com_port, modem_rate, this_zone, line_abort,
CreditVal, UpCredit);
ReadLn(config_file, dok, dok, ets, co, am, ll, r300, rp, ma,
dd, fo, macro); {first dok eats space}
ReadLn(config_file, fido_sysop);
fido_sysop := StUpcase(fido_sysop);
ReadLn(config_file, fidomail);
ReadLn(config_file, fidolists);
ReadLn(config_file, question);
ReadLn(config_file, menu_password);
ReadLn(config_file, OKAY);
ReadLn(config_file, RING);
ReadLn(config_file, connect300);
ReadLn(config_file, connect1200);
ReadLn(config_file, connect2400);
ReadLn(config_file, connect9600);
ReadLn(config_file, connect1200ecc);
if connect1200ecc = '' then
AllowMNP := False
else
AllowMNP := True;
ReadLn(config_file, connect2400ecc);
ReadLn(config_file, connect9600ecc);
ReadLn(config_file, Error);
ReadLn(config_file, init_str);
ReadLn(config_file, off_hook_str);
ReadLn(config_file, answer_str);
ReadLn(config_file, hang_up_str);
if Length(menu_password) > 1 then
for i := 1 to Length(menu_password) do
menu_password[i] := Char(Ord(menu_password[i]) xor $0a);
if macro = '' then
macro := Deflt_macro
else
macro := trim(macro); {delete leading & trailing spaces}
if ets = 'T' then
extra_time_sw := True
else
extra_time_sw := False;
if co = 'T' then
chat_ok := True
else
chat_ok := False;
if am = 'T' then
auto_macro := True
else
auto_macro := False;
if ll = 'T' then
limit_lines := True
else
limit_lines := False;
if r300 = 'T' then
restrict300 := True
else
restrict300 := False;
if rp = 'T' then
restrict_public := True
else
restrict_public := False;
if dok = 'T' then
down_ok := True
else
down_ok := False;
if ma = 'T' then
modem_answer := True
else
modem_answer := False;
if dd = 'T' then
disp_dir := True
else
disp_dir := False;
if fo = 'T' then
format := True
else
format := False;
case CreditVal of
1 :
CreditType := Points;
2 :
CreditType := Kilobytes;
3 :
CreditType := Files;
end;
Close(config_file);
end
else
begin
WriteLn(BEL, 'Can''t find CONFIG.BB#. Run SETUP.EXE to correct.');
Halt;
end;
end;
procedure ReadOrigFile;
begin
my_zone := Long2Str(this_zone);
my_net := Long2Str(this_net);
my_node := Long2Str(this_node);
orig_line := '';
Assign(orig_file, 'ORIGIN');
{$I-}
Reset(orig_file);
{$I+}
if IoResult = 0 then
begin
ReadLn(orig_file, orig_line);
Close(orig_file);
end;
orig_line := ' * Origin: '+orig_line+' ('+my_zone+':'+my_net+'/'+my_node+')'
+CR+LF;
tear_line := CR+LF+CR+LF+'--- '+Version+CR+LF;
seenby_line := 'SEEN-BY: '+my_net+'/'+my_node+' '+CR+LF;
end;
procedure ReadSectionFile;
type
Section_rec =
record
sdrive : Char;
suser : Integer;
saccs : Integer;
confnum : Integer;
sname : DosFileName;
sdesc : StrPr;
mode : Char;
end;
var
Sect_File : file of Section_rec;
sect_rec : Section_rec;
found_file_secs,
found_post,
found_system,
Samedrive, OK : Boolean;
artcount : Integer;
drive : Str3;
areathis,
arealast : AreaPtr;
sectthis,
sectlast : SectPtr;
artthis,
artlast : ArtPtr;
temp : string;
Section : DosFileName;
begin
printer_copy := False; {turn off printer..just in case}
found_file_secs := True;
found_post := False;
found_system := False;
artcount := 0;
Assign(Sect_File, sect_name+ext);
{$I-}
Reset(Sect_File) {$I+} ; { Build file and message section lists }
OK := (IoResult = 0);
if OK then
begin
Seek(Sect_File, 0);
while not EoF(Sect_File) do
with sect_rec do
begin
Read(Sect_File, sect_rec);
if mode = 'M' then
begin {message areas}
if trim(sname) = 'POST' then
found_post := True;
if trim(sname) = 'SYSTEM' then
found_system := True;
New(areathis);
if AreaBase = nil then
AreaBase := areathis
else
arealast^.next := areathis;
arealast := areathis;
arealast^.Area := suser;
if confnum > 0 then
arealast^.AreaConf := confnum
else
arealast^.AreaConf := 0;
if (confnum > 0) and (not cmd_tail) then
begin
WriteLn;
WriteLn('Activating Message Conference number ', confnum);
Delay(500);
end;
arealast^.AreaAccs := saccs;
arealast^.AreaName := trim(sname);
arealast^.AreaDesc := trim(sdesc);
arealast^.next := nil
end
else if mode = 'F' then
begin
New(sectthis); {file sections}
if SectBase = nil then
SectBase := sectthis
else
sectlast^.next := sectthis;
sectlast := sectthis;
sectlast^.SectDrive := sdrive;
sectlast^.SectUser := suser;
if confnum > 0 then
sectlast^.SectConf := confnum
else
sectlast^.SectConf := 0;
if (confnum > 0) and (not cmd_tail) then
begin
WriteLn;
WriteLn('Activating Files Conference number ', confnum);
Delay(500);
end;
sectlast^.SectAccs := saccs;
sectlast^.SectName := trim(sname);
sectlast^.SectDesc := trim(sdesc);
sectlast^.next := nil;
end
else if mode = 'A' then
begin
New(artthis);
if Artbase = nil then
Artbase := artthis
else
artlast^.next := artthis;
Inc(artcount);
artlast := artthis;
artlast^.Artdrive := sdrive;
artlast^.ArtUser := suser;
artlast^.ArtAccs := saccs;
artlast^.Artnum := artcount;
artlast^.ArtName := trim(sname);
artlast^.ArtDesc := trim(sdesc);
artlast^.next := nil;
end;
end; {eof reached}
Close(Sect_File);
Section := 'NEWIN';
FindSect(Section, RcvDrv, OK); {sets up area to recv. files}
if OK then
begin
RcvName := RcvDrv;
if (Length(HomName) > 3) and (RcvName = HomDrv) then
begin
RcvName := RcvName+Copy(HomName, 4, Length(HomName));
RcvName := RcvName+'\';
end;
RcvName := RcvName+'NEWIN';
end
else
begin
WriteLn(BEL, 'NEWIN file section name not found.');
found_file_secs := False;
end;
Section := 'LOGIN';
FindSect(Section, drive, OK);
if not OK then
begin
WriteLn(BEL, 'LOGIN file section name not found.');
found_file_secs := False;
end;
Section := 'SYSTEM';
FindSect(Section, drive, OK);
if not OK then
begin
WriteLn(BEL, 'SYSTEM file section name not found.');
found_file_secs := False;
end;
if not found_post then
WriteLn('POST message area name not found.');
if not found_system then
WriteLn('SYSTEM message area name not found.');
if (not found_file_secs) or (not found_post) or (not found_system) then
begin
WriteLn;
WriteLn(BEL, 'Unable to continue. Re-run SETUP.EXE');
Halt;
end;
end {was able to read section.bb# file}
else
begin
WriteLn(BEL, 'Section file not found. Run SETUP.EXE to create.');
WriteLn(BEL, 'Unable to continue.');
Halt;
end;
temp := StUpCase(GetEnvironmentString('dszlog='));
if Length(HomName) > 3 then
st := HomName+'\'
else
st := HomName;
if temp <> st+'DSZ.LOG' then
begin
WriteLn(BEL, 'DSZLOG environment variable missing or invalid.');
WriteLn(BEL, 'Unable to continue.');
if Length(HomName) > 3 then
st := HomName+'\'
else
st := HomName;
WriteLn(BEL, 'Use SET DSZLOG=', st, 'DSZ.LOG in your AUTOEXEC.BAT file.');
Halt
end;
Ch_Init; {initialize the communications}
end;
end. { OF INITIAL3.PAS }